package Database;

import java.sql.Connection;
import java.sql.DriverManager;

public class MySqlConnection {
    private final String dbUserName = "nmedin4-rw";
    private final String dbPassword = "suitepee";
    private final String dbDriver = "com.mysql.jdbc.Driver";
    private final String dbUrl = "jdbc:mysql://nmedin4.mysql.uic.edu/nmedin4";
	private Connection Con = null;
	
	public MySqlConnection(){
        try{
            Class.forName(dbDriver).newInstance();
            this.Con = DriverManager.getConnection(dbUrl,dbUserName,dbPassword);
        }catch(Exception e){
            System.err.println("Exception: " + e.getMessage());
            System.err.println(dbDriver + "not found!");
        }
	}
	public Connection getConnection(){
		return this.Con;
	}
	public void tearDown(){
        try{
        	this.Con.close();
        }catch(Exception e){
        	e.printStackTrace();
        }
	}
}
